package com.itheima.reggie.common;

/**
 * 公共类(ThreadLocal)
 *
 * @author panda
 * @since 2022/12/30 23:16
 */
public class BaseContext {
    /**
     * 设计完成公共类后需要把需要的参数传入到ThreadLocal中
     * filter
     */
    private static final ThreadLocal<Long> THREAD_LOCAL_USER_ID =
            new ThreadLocal<>();

    public static void setCurrentId(Long id) {
        THREAD_LOCAL_USER_ID.set(id);
    }

    public static Long getCurrentId() {
        return THREAD_LOCAL_USER_ID.get();
    }
}